/*
 @Date: 2022/4/23
 @Desc: 程序主入口
 */

import UIKit

class ViewController: UITabBarController {

    override func viewDidLoad() {
        super.viewDidLoad()
        configureSubController()
        
        let test = "bkggk"
        print("--swift 测试打印转16进制->\(test.toHexString())")
        
        let oc = HMACSHA1.data(fromHexString: test)
        let s = HMACSHA1.convertData(toHexStr: oc)
        print("--oc 测试打印转16进制->\(s)")
        
        let dw = HMACSHA1.hmacsha1(test, key: "key")
        let sw = test.hmacsha256("key")
        print("--hmac sha256 加密--oc==\(dw) sw==\(sw)")
        
    }
    
    private func configureSubController(){
        let datas: [(name: String,imgName: String, cls: String)] = [("首页","tab_camera","IPHomeViewController"),("咨询","tab_news","IPNewsViewController"),("相册","tab_ablum","IPAblumViewController"),("我的","tab_mine","IPMineViewController")]
        
        let subs: [UIViewController] = datas.map { it -> UIViewController in
            let vc = it.cls.ip2Vc() ?? UIViewController()
            let normal = UIImage.init(named: it.imgName + "_normal")
            let select = UIImage.init(named: it.imgName + "_select")
            let item = UITabBarItem.init(title: it.name, image: normal, selectedImage: select)
            let nv = IPBaseNavigationController.init(rootViewController: vc)
            nv.tabBarItem = item
            return nv
        }
        
        viewControllers = subs
    }

}

